package com.wisewin.circle.service;

import com.wisewin.circle.config.dto.ResultDTO;
import com.wisewin.circle.config.dto.ResultDTOBuilder;
import com.wisewin.circle.dao.FeedbackDAO;
import com.wisewin.circle.entity.db.FeedbackDO;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class FeedbackService {

    @Autowired
    private FeedbackDAO feedbackDAO;

    // 添加帮助与反馈
    public ResultDTO addFeedback(FeedbackDO feedbackDO){
        if(StringUtils.isEmpty(feedbackDO.getContent())){
            return ResultDTOBuilder.failure("1", "请填写帮助与反馈内容", null);
        }
        // 添加帮助与反馈
        feedbackDAO.insert(feedbackDO);
        return ResultDTOBuilder.success(feedbackDO);
    }
}
